home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 4 / The 640 Meg Shareware Studio CD-ROM Volume IV (Data Express)(1994).ISO / clang / cujaug93.zip / 1108093A < prev    next >
Text File  |  1993-06-08  |  7KB  |  201 lines

  1.         case 19: /* shape operations */
  2.          printf("\nCIPS> Enter input image name\n");
  3.          get_image_name(name);
  4.          printf("\nCIPS> Enter output image name\n");
  5.          get_image_name(name2);
  6.          get_parameters(&il, &ie, &ll, &le);
  7.          get_shape_options(low_high, &value,
  8.                            &threshold, &number);
  9.          if(strncmp("thi", low_high, 3) == 0){
  10.             thinning(name, name2, the_image, out_image,
  11.                      il, ie, ll, le, 
  12.                      value, threshold, 0);
  13.          }
  14.          if(strncmp("dnj", low_high, 3) == 0){
  15.             dilate_not_join(name, name2, the_image, 
  16.                             out_image, il, ie, ll, le, 
  17.                             value, threshold);
  18.          }
  19.          if(strncmp("ero", low_high, 3) == 0){
  20.             erosion(name, name2, the_image, out_image, 
  21.                     il, ie, ll, le, value, threshold);
  22.          }
  23.          if(strncmp("dil", low_high, 3) == 0){
  24.             dilation(name, name2, the_image, out_image, 
  25.                      il, ie, ll, le, value, threshold);
  26.          }
  27.          if(strncmp("mer", low_high, 3) == 0){
  28.             mask_erosion(name, name2, the_image, 
  29.                          out_image, il, ie, ll, le, 
  30.                          value, threshold);
  31.          }
  32.          if(strncmp("mdi", low_high, 3) == 0){
  33.             mask_dilation(name, name2, the_image, 
  34.                           out_image, il, ie, ll, le, 
  35.                           value, threshold);
  36.          }
  37.          if(strncmp("int", low_high, 3) == 0){
  38.             interior_outline(name, name2, the_image, 
  39.                              out_image, il, ie, ll, le, 
  40.                              value, threshold);
  41.          }
  42.          if(strncmp("ext", low_high, 3) == 0){
  43.             exterior_outline(name, name2, the_image, 
  44.                              out_image, il, ie, ll, le, 
  45.                              value, threshold);
  46.          }
  47.          if(strncmp("ope", low_high, 3) == 0){
  48.             opening(name, name2, the_image, out_image,
  49.                     il, ie, ll, le, value, threshold,
  50.                     number);
  51.          }
  52.          if(strncmp("clo", low_high, 3) == 0){
  53.             closing(name, name2, the_image, out_image,
  54.                     il, ie, ll, le, value, threshold,
  55.                     number);
  56.          }
  57.          if(strncmp("spo", low_high, 3) == 0){
  58.             special_opening(name, name2, the_image, 
  59.                             out_image, il, ie, ll, le, 
  60.                             value, threshold,
  61.                             number);
  62.          }
  63.          if(strncmp("spc", low_high, 3) == 0){
  64.             special_closing(name, name2, the_image, 
  65.                             out_image, il, ie, ll, le, 
  66.                             value, threshold,
  67.                             number);
  68.          }
  69.          if(strncmp("edm", low_high, 3) == 0){
  70.             edm(name, name2, the_image, out_image, 
  71.                 il, ie, ll, le, value);
  72.          }
  73.          if(strncmp("mat", low_high, 3) == 0){
  74.             edm(name, name2, the_image, out_image, 
  75.                 il, ie, ll, le, value);
  76.          }
  77.         break;
  78.  
  79.         case 30:  /* exit system */
  80.          not_finished = 0;
  81.         break;
  82.  
  83.                     .
  84.                     .
  85.                     .
  86.  
  87.    /*************************************************
  88.    *
  89.    *   show_menu(..
  90.    *
  91.    *   This function displays the CIPS main menu.
  92.    *
  93.    **************************************************/
  94. show_menu()
  95. {
  96.  
  97.  
  98.  printf(""
  99.  "\n\n\t\t\tWelcome to CIPS"
  100.  "\n\t\tThe C Image Processing System"
  101.  "\n\t\tDwayne Phillips 1990-1993"
  102.  "\nThese are your choices:"
  103.  "\n1.  Display image header               11. Image add & subtract"
  104.  "\n2.  Show image numbers                 12. Image cut & paste"
  105.  "\n3.  Print image numbers                13. Image rotate & flip"
  106.  "\n4.  Display (EGA & VGA)                14. Image scaling"
  107.  "\n5.  Display or print using halftoning  15. Create blank image"
  108.  "\n6.  Print using dithering              16. Image thresholding"
  109.  "\n7.  Print or display histogram         17. Image segmentation"
  110.  "\n8.  Edge Detection                     18. Edge & gray segmentation"
  111.  "\n9.  Edge Enhancement                   19. Shape operations"
  112.  "\n10. Image filtering"
  113.  "\n"
  114.  "\n30. Exit system\n"
  115.  "\nEnter choice __\b\b");
  116.  
  117. }  /* ends show_menu */
  118.  
  119.                     .
  120.                     .
  121.                     .
  122.  
  123.      /*******************************************
  124.      *
  125.      *   get_shape_options(...
  126.      *
  127.      *   This function interacts with the user
  128.      *   to obtain the parameters for calling
  129.      *   the shape routines.
  130.      *
  131.      *******************************************/
  132.  
  133. get_shape_options(type, value, threshold, number)
  134.    char   type[];
  135.    int    *number, *threshold;
  136.    short  *value;
  137. {
  138.    int not_finished = 1, response;
  139.  
  140.    while(not_finished){
  141.  
  142.    printf("\nThe shape options are:");
  143.    printf("\n\t1. Type is %s", type);
  144.    printf("\n\t    recall: EROsion DILation Mask-ERosion"
  145.           "\n\t            Mask_DIlation INTerior-outline"
  146.           "\n\t            EXTerior-outline THInning"
  147.           "\n\t            Dilate-Not-Join OPEning"
  148.           "\n\t            CLOsing SPecial-Opening"
  149.           "\n\t            SPecial-Closing"
  150.           "\n\t            Euclidean-Distance-Measure"
  151.           "\n\t            Medial-Axis-Transform");
  152.    printf("\n\t2. value is %d", *value);
  153.    printf("\n\t3. threshold or mask type is %d",
  154.            *threshold);
  155.    printf("\n\t4. number of iterations is %d", *number);
  156.    printf("\n\t   (used only in opening and closing)");
  157.    printf("\n\nEnter choice (0 = no change) _\b");
  158.  
  159.       get_integer(&response);
  160.  
  161.       if(response == 0){
  162.         not_finished = 0;
  163.       }
  164.  
  165.       if(response == 1){
  166.       printf("\nEnter type of operation");
  167.       printf("\n\t    recall: EROsion DILation Mask-ERosion"
  168.              "\n\t            Mask_DIlation INTerior-outline"
  169.              "\n\t            EXTerior-outline THInning"
  170.              "\n\t            Dilate-Not-Join OPEning"
  171.              "\n\t            CLOsing SPecial-Opening"
  172.              "\n\t            SPecial-Closing"
  173.              "\n\t            Euclidean-Distance-Measure"
  174.              "\n\t            Medial-Axis-Transform");
  175.       printf("\n\t:");
  176.       gets(type);
  177.       }
  178.  
  179.       if(response == 2){
  180.          printf("\nEnter value: ___\b\b\b");
  181.          get_integer(value);
  182.       }
  183.  
  184.       if(response == 3){
  185.          printf("\nEnter threshold or mask type: ___");
  186.          printf("\b\b\b");
  187.          get_integer(threshold);
  188.       }
  189.  
  190.       if(response == 4){
  191.          printf("\nEnter number of iterations: ___");
  192.          printf("\b\b\b");
  193.          get_integer(number);
  194.       }
  195.  
  196.    }  /* ends while not_finished */
  197.  
  198. }  /* ends get_shape_options */
  199.  
  200.  
  201.